import { createApp } from 'vue'
//导入应用
import App from './App.vue'
//导入路由
import router from './router'
//导入pinia
import { createPinia } from 'pinia'
//导入element-plus
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'
//导入element-plus图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import PiniaPluginPersistedstate from 'pinia-plugin-persistedstate'

// 导入Font Awesome核心组件
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'

// 导入图标配置文件
import '@icons/menuIcon'
import '@icons/brand'
import '@icons/commons'

// 引入 Tailwind CSS
import '@/assets/css/tailwind.css'
import '@/assets/css/main.css'

//创建应用
const app = createApp(App)
//注册图标组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
// 注册Font Awesome组件（全局组件）
app.component('FontAwesomeIcon', FontAwesomeIcon)

//应用elementplus, router, pinia
app.use(ElementPlus, {
    locale: zhCn,
})
app.use(router)
app.use(createPinia().use(PiniaPluginPersistedstate))
//挂载应用
app.mount('#app')
